<script setup lang="ts">
const props = defineProps({
  isActive: {
    type: Boolean,
    default: false
  }
});

const emit = defineEmits();
const toggleClick = () => {
  emit('toggleClick');
};
</script>

<template>
  <div style="padding: 0 15px;" @click="toggleClick">
    <svg :class="{ 'is-active': isActive }" class="hamburger" xmlns="http://www.w3.org/2000/svg" width="256" height="256" viewBox="0 0 24 24">
      <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-width="2.80" data-swindex="0">
        <path stroke-dasharray="10" stroke-dashoffset="10" d="M3 9L6 12L3 15">
          <animate fill="freeze" attributeName="stroke-dashoffset" dur="0.2s" values="10;0"></animate>
        </path>
        <path stroke-dasharray="16" stroke-dashoffset="16" d="M5 5H19">
          <animate fill="freeze" attributeName="stroke-dashoffset" begin="0.2s" dur="0.2s" values="16;0"></animate>
        </path>
        <path stroke-dasharray="12" stroke-dashoffset="12" d="M10 12H19">
          <animate fill="freeze" attributeName="stroke-dashoffset" begin="0.4s" dur="0.2s" values="12;0"></animate>
        </path>
        <path stroke-dasharray="16" stroke-dashoffset="16" d="M5 19H19">
          <animate fill="freeze" attributeName="stroke-dashoffset" begin="0.6s" dur="0.2s" values="16;0"></animate>
        </path>
      </g>
    </svg>
  </div>
</template>

<style scoped>
.hamburger {
  display: inline-block;
  vertical-align: middle;
  width: 20px;
  height: 20px;
  fill: currentColor;
  color: var(--el-menu-text-color);;
}

.hamburger.is-active {
  transform: rotate(180deg);
}
</style>
